using System;
using System.Windows;
using System.Windows.Controls;

namespace Graphe.Windows.Controls
{
    /// <summary>
    /// Class used to dynamically select the xaml style for a manuscript thumbnail or an index heading item.
    /// </summary>
    public class ManuscriptThumbnailStyleSelector : StyleSelector
    {
        public override System.Windows.Style SelectStyle(object item, DependencyObject container)
        {
            if (item != null)
            {
                Window window = Application.Current.MainWindow;
                if (item is IndexItem)
                    return window.FindResource("IndexItem") as Style;
                else
                    return window.FindResource("ManuscriptImageItem") as Style;
            }

            return null;
        }
    }
}
